<script type="text/javascript" src="/templates/ip_js.js"></script>
<script type="text/javascript">
  $(document).ready(function(){

$(function() {
    $('#start_date').datepicker({
        altFormat: 'dd mm yy'});
    $('#stop_date').datepicker({
        altFormat: 'dd mm yy'});
    $('#birthday').datepicker({
        yearRange: '1930:2000',
        changeYear:true,
        changeMonth:true,
        altFormat: 'dd mm yy'});
  });


    $("#ae_form").validate({
  rules: {
    partita_iva: {
      number: true
    },}});
});
</script>
{% if pageData["dao"] %}
{% include "giustopeso/azioni_prof.html" with context %}
{% endif %}

{% if pageData["action"] == "edit"%}
<script>
$('.cmxform').ajaxForm(function() {
                alert("DATI SALVATI CORRETTAMENTE");
            });
{% if  pageData["role"] != "UTENTI" %}
    $(".infopeso").show()
    $(".ordine_da_cliente").show()
        $(".metodo").show()
        $(".edit").show()
{% endif %}
</script>

<br>
<form class="cmxform" id="ae_form" action="/anagrafiche/cliente/fromedit" method="post">
<input type="hidden" name="id" value="{{pageData['dao'].id}}"/>
<input type="hidden" name="idr" value="{{pageData['dao'].id}}"/>
<input type="hidden" name="id_cliente" value="{{pageData['dao'].id}}"/>

{% elif pageData["action"] == "new" %}
<script>
    $(".infopeso").hide()
    $(".ordine_da_cliente").hide()
    $(".metodo").hide()
    $(".edit").hide()
</script>
<form class="cmxform" id="ae_form" action="/anagrafiche/cliente/add" method="post">
{% endif %}
<input type="hidden" name="attivita" value="{{pageData['attivita']}}"/>
<input type="hidden" name="id" value="{{pageData['dao'].id}}"/>
<input type="hidden" name="tip_id" value="{{pageData['testata_infopeso'].id}}"/>
<input type="hidden" name="tg_id" value="{{pageData['generalita'].id}}"/>
<table cellpadding="4" cellspacing="4" border="0" style="width:500px">

    <tr>
        <td colspan="2" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Cognome:</td>
    <td align="left"><input class="required" type="text" name="cognome" size="60" value='{{pageData["dao"].cognome|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Nome:</td>
    <td align="left"><input  class="required" type="text" name="nome" size="60" value='{{pageData["dao"].nome|nonone}}' /></td>
</tr>

    <tr>
        <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Codice Fiscale:</td>
    <td align="left"><input  class="required" type="text" name="codice_fiscale" size="20" value='{{pageData["dao"].codice_fiscale|nonone}}' /></td>
</tr>

    <tr>
        <td colspan="2" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <b class="titoletto">GENERALITA':</b><br>

<tr>
    <td colspan="2" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
</tr>
<tr>
    <td align="left" width="110">Città di nascita:</td>
    <td align="left" width=""><input type="text" name="citta" size="20" value='{{pageData["testata_infopeso"].citta|nonone}}' /></td>
</tr>
<tr>
    <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
</tr>

<tr>
    <td align="left">Data di nascita:</td>
    <td align="left"><input type="text" id="birthday" name="data_nascita" value ="{{pageData['generalita'].data_nascita|dateformat}}" /></td>
</tr>
<tr>
    <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
</tr>
<tr>
    <td align="left">Altezza:</td>
    <td align="left"><input type="text" name="altezza" size="20" value='{{utils.mN(pageData["generalita"].altezza|nonone,1)}}' /></td>
</tr>
<tr>
    <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
</tr>
<tr>
    <td align="left">Sesso:</td>
    <td align="left">
       <table cellpadding="2" cellspacing="0" border="0" class="tbl_pesata2">
        <tr>
{% if pageData["generalita"].genere == "Donna" %}
        <td><input type="radio" name="genere" CHECKED value="Donna"/></td><td>Donna</td>
{% else %}
    <td><input type="radio" name="genere" value="Donna"/></td><td>Donna</td>
{% endif %}
{% if pageData["generalita"].genere == "Uomo" %}
    <td><input type="radio" name="genere" CHECKED value="Uomo"/></td><td>Uomo</td>
{% else %}
    <td><input type="radio" name="genere" value="Uomo"/></td><td>Uomo</td>
{% endif %}
    <td width="20">&nbsp;</td>


{% if pageData["role"] == "PROFESSIONISTA" %}
{% if pageData["testata_infopeso"].privacy == True %}
    <td><input type="checkbox" name="privacy" CHECKED value="1"/></td>
{% else %}
    <td><input type="checkbox" name="privacy" value="1"/></td>
{% endif %}

{% else %}

{% if pageData["testata_infopeso"].privacy == True %}
    <td><input type="checkbox" name="privacy" CHECKED value="1" DISABLED/></td>
{% else %}
    <td><input type="checkbox" name="privacy" value="1" DISABLED/></td>
{% endif %}


{% endif %}

    <td><a href="#" class="linkscheda">Privacy</a></td>
        </tr>
        </table>

</td>
</tr>
<tr>
    <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
</tr>
<!--
<tr>
    <td align="left" valign="top">Note:</td>
    <td align="left"><textarea name="note" rows="5" cols="50" value='{{pageData["testata_infopeso"].note|nonone}}' >{{pageData["testata_infopeso"].note|nonone}}</textarea></td>
</tr>
-->
<tr>
    <td colspan="2" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
</tr>


<td colspan="2" class="tdSez"><b>Informazioni Generali</b></td>
</tr>

    <tr>
        <td colspan="2" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Indirizzo:</td>
    <td align="left"><input  class="required"type="text" name="sede_legale_indirizzo" size="60" value='{{pageData["dao"].sede_legale_indirizzo|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Località:</td>
    <td align="left"><input  class="required" type="text" name="sede_legale_localita" size="60" value='{{pageData["dao"].sede_legale_localita|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">CAP:</td>
    <td align="left"><input  class="required" type="text" name="sede_legale_cap" size="5" value='{{pageData["dao"].sede_legale_cap|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Provincia:</td>
    <td align="left"><input  class="required" type="text" name="sede_legale_provincia" size="2" value='{{pageData["dao"].sede_legale_provincia|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>

<tr>
<td colspan="2" class="tdSez"><b>Indirizzo Spedizione merce (se diverso)</b></td>
</tr>

    <tr>
        <td colspan="2" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Denominazione:</td>
    <td align="left"><input  type="text" name="denominazione_altra_destinazione" size="60" value='{{pageData["dm"].denominazione|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Indirizzo:</td>
    <td align="left"><input  type="text" name="indirizzo_altra_destinazione" size="60" value='{{pageData["dm"].indirizzo|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Località:</td>
    <td align="left"><input   type="text" name="localita_altra_destinazione" size="60" value='{{pageData["dm"].localita|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">CAP:</td>
    <td align="left"><input   type="text" name="cap_altra_destinazione" size="5" value='{{pageData["dm"].cap|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Provincia:</td>
    <td align="left"><input   type="text" name="provincia_altra_destinazione" size="2" value='{{pageData["dm"].provincia|nonone}}' /></td>
</tr>


    <tr>
        <td colspan="2" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>

<tr>
<td colspan="2" class="tdSez"><b>Contatti principali</b> </td>
</tr>
    <tr>
        <td colspan="2" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Telefono:</td>
    <td align="left"><input type="text" name="cliente_telefono_principale" size="60" value='{{pageData["dao"].telefono_principale|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Cellulare:</td>
    <td align="left"><input  class="required" type="text" name="cliente_cellulare_principale" size="60" value='{{pageData["dao"].cellulare_principale|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Email:</td>
    <td align="left"><input  type="text" name="cliente_email_principale" size="60" class="email" value='{{pageData["dao"].email_principale|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
  <tr>
      {% if pageData["role"] == "PROFESSIONISTA" %}
{% if pageData["dao"].email_confirmed == True %}
    <td><input type="checkbox" name="email_confirmed" CHECKED value="1" /></td>
{% else %}
    <td><input type="checkbox" name="email_confirmed" value="1" /></td>
{% endif %}
    <td>Conferma Email</td>
    </tr>
{% endif %}

<tr>
    <td align="left">Note:</td>
    <td align="left"><input type="text" name="cliente_note" size="60" value='{{pageData["dao"].note|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>

<tr>
<td colspan="2" class="tdSez"><b>Dati di accesso al sito (Generati in automatico nel momento del salvataggio paziente) </b> </td>
</tr>
    <tr>
        <td colspan="2" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Username:</td>
    <td align="left"><input type="text"  name="username" size="60" readonly="readonly" value='{{pageData["dao"].username_login|nonone}}' /></td>
</tr>
    <tr>
        <td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left">Password:</td>
    {% if pageData["dao"] %}
    <td align="left"><input type="text" class="required"  name="password" size="60" value='{{pageData["dao"].password_login|nonone}}' /></td>
    {% else %}
<td align="left"><input type="text" name="password" size="60"  /></td>

    {% endif %}
</tr>
    <tr>
        <td colspan="2" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
    </tr>
<tr>
    <td align="left"colspan="2">
    <input type="submit" name="add" value="Salva" />
    </td>
</tr>
</table>
</form>
